package com.xiaoxi.open.design.behavioral.chainofresponsibilitypattern.service.verify;

import com.xiaoxi.open.design.behavioral.chainofresponsibilitypattern.domain.verify.UserInfo;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * @Author xiaoxi
 * @ProjectName chain_of_responsibility_pattern
 * @PackageName com.xiaoxi.open.design.behavioral.chainofresponsibilitypattern.service.verify
 * @ClassName CheckUserEnable
 * @Description TODO
 * @Date 2024/4/24 18:22
 * @Version 1.0
 */
@Component
public class UserEnableCheck extends AbstractLoginCheck {


    @Override
    public void doHandler(UserInfo userInfo) throws Exception {
        if (!userInfo.getIsLoginEnable()) {
            throw new Exception("用户已被禁用, 解封时间：" + LocalDateTime.now());
        }
    }

}
